<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>#{msg.faiSpesa}</title>
        <style>
            .ui-accordion .ui-accordion-content {
                padding: 0px;
            }
            .DataTable table > thead > tr > th,
            .DataTable table > tbody,
            .DataTable table > tbody > tr,
            .DataTable table > tbody > tr > td {
                border: none !important;
            }
            .DataTable table * {
                border: none !important;
            }            
        </style>
    </h:head>
    <h:body>
        #{carrelloManager.setCarrello(gestioneCliente)}
        #{spesaM.setRedirect(redirect)}
        #{spesaM.setCliente(gestioneCliente)}
        #{spesaM.setCarrello(carrelloManager)}
        #{spesaM.redirectFromSpesa()}
        <div class="container">
            <ui:include src="Header.xhtml"/>
            <div class="content">
                <h3>
                    <p:outputLabel value="#{msg.podDisponibili}"/>
                </h3>
                <h:form>
                    <p:growl autoUpdate="true"/>
                    <p:accordionPanel value="#{spesaM.reparti }" cache="true" dynamic="true" multiple="true" var="r" style="min-height: 300px;" >
                        <p:tab title="#{r.nome}">
                            <p:dataTable var="p" value="#{spesaM.prodottiDaVisualizzare(r)}" style="text-align: center;">
                                <p:column>
                                    <p:rowToggler/>
                                </p:column>
                                <p:column headerText="#{msg.immageTable}">
                                    <p:graphicImage value="#{p.foto.fotoPath()}" height="80" width="100"/>
                                </p:column>
                                <p:column headerText="#{msg.nomeTable}">
                                    <p:outputLabel value="#{p.nome}"/>
                                </p:column>
                                <p:column headerText="#{msg.prezzoTable}">
                                    <h:outputFormat value="#{spesaM.prezzoProdotto(p)}">
                                        <f:convertNumber minFractionDigits="2" maxFractionDigits="2"/>
                                    </h:outputFormat> €
                                </p:column>
                                <p:column headerText="#{msg.aggiungiCarrello}">
                                    <p:commandButton icon="ui-icon-cart" id="iconOnly" actionListener="#{spesaM.aggiungiAlCarrello(p)}">
                                    </p:commandButton>
                                </p:column>
                                <p:rowExpansion>
                                    <p:outputLabel>#{msg.descrizioneForm}</p:outputLabel><br/>
                                    <p:outputLabel>#{p.descrizione}</p:outputLabel>
                                </p:rowExpansion>
                            </p:dataTable>
                        </p:tab>
                    </p:accordionPanel>
                    <p style="margin-top: 20px;">
                        <p:commandButton action="SelezioneNegozio" style="margin-right: 700px;" value="#{msg.indietroLable}"/>
                        <p:commandButton action="Carrello" value="#{msg.continuaLable}"/>
                    </p>
                </h:form>
            </div>
            <ui:include src="Footer.xhtml"/>
        </div>
    </h:body>
</html>

